package com.dk.controller;


import com.dk.service.CraftRelatedProductService;
import com.dk.vo.CraftRelatedProductVO;
import com.dongdongshop.data.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  物料,工艺流程中间表 前端控制器
 * </p>
 *
 * @author wbh
 * @since 2023-03-20
 */
@RestController
@RequestMapping("craftRelatedProduct")
public class CraftRelatedProductController {
    @Autowired
    private CraftRelatedProductService craftRelatedProductService;

    /**
     *
     * @param craftRelatedProductVO craftRouteId必传
     * @return
     */
    @GetMapping("getInfoList")
    public Result getInfoList(CraftRelatedProductVO craftRelatedProductVO){
        CraftRelatedProductVO relatedProductVO = craftRelatedProductService.getInfoList(craftRelatedProductVO);
        return Result.OK().setData(relatedProductVO);
    }

    @PostMapping("insertInfoCraftRelatedProduct")
    public Result insertInfoCraftRelatedProduct(CraftRelatedProductVO craftRelatedProductVO){
        Result result = craftRelatedProductService.insertInfoCraftRelatedProduct(craftRelatedProductVO);
        return result;
    }

    @GetMapping("getInfoCraftRelatedProductById")
    public Result getInfoCraftRelatedProductById(Integer id){
        CraftRelatedProductVO craftRelatedProductVO = craftRelatedProductService.getInfoCraftRelatedProductById(id);
        return Result.OK().setData(craftRelatedProductVO);
    }

    @PostMapping("updateInfoCraftRelatedProductById")
    public Result updateInfoCraftRelatedProductById(CraftRelatedProductVO craftRelatedProductVO){
        Result result = craftRelatedProductService.updateInfoCraftRelatedProductById(craftRelatedProductVO);
        return result;
    }

    @DeleteMapping("deleteInfoCraftRelatedProductById")
    public Result deleteInfoCraftRelatedProductById(Integer id){
        craftRelatedProductService.deleteInfoCraftRelatedProductById(id);
        return Result.OK();
    }


}

